package com.zyg.controller;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.ShearCaptcha;
import com.alibaba.fastjson2.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {

    @RequestMapping
    public String tologin(){
        return "login";
    }
    @RequestMapping("/captcha")
    @ResponseBody
    public String captcha(){
        ShearCaptcha captcha = CaptchaUtil.createShearCaptcha(200, 100, 4, 4);
        String data = JSON.toJSONString(captcha.getImageBase64());
        return data;
    }


}
